package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.Ticket;
import cn.wolfcode.luowowo.article.mapper.TicketMapper;
import cn.wolfcode.luowowo.article.service.ITicketService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class TicketServiceImpl implements ITicketService {

    @Autowired
    private TicketMapper ticketMapper;

    @Override
    public void save(Ticket ticket) {
        ticketMapper.insert(ticket);
    }

    @Override
    public void delete(Long ticketId) {
        ticketMapper.deleteByPrimaryKey(ticketId);
    }

    @Override
    public void update(Ticket ticket) {
        ticketMapper.updateByPrimaryKey(ticket);
    }

    @Override
    public Ticket get(Long ticketId) {
        return ticketMapper.selectByPrimaryKey(ticketId);
    }

    @Override
    public List<Ticket> list() {
        return ticketMapper.selectAll();
    }

    @Override
    public List<Ticket> listByDestId(Long destId) {
        return ticketMapper.listByDestId(destId);
    }

    @Override
    public List<Ticket> listTicketByDestId(Long destId) {
        return ticketMapper.listTicketByDestId(destId);
    }

    @Override
    public List<Ticket> listByDestIdAndTagId(Long destId, Long tagId) {
        return ticketMapper.listByDestIdAndTagId(destId, tagId);
    }
}
